package entity;

import utils.SplitWord;

import java.util.List;

/**
 * Created by 梅晨 on 2017/7/20.
 */
public class News extends NewsInfo {
    private List<String> words;
    private List<Float> vec;
    private String dicContent;
    private int emotionIndex;
    private SplitWord splitWord;

    public News(String title,String content,int emotionIndex,SplitWord splitWord) {
        super(title,content);
        this.setEmotionIndex(emotionIndex);
        this.splitWord = splitWord;
        initNews();
    }

    /**
     * 初始化News对象中的变量，对文本内容进行分词，得到词的list,构建dicContent
     */
    private void initNews(){
        dicContent = "";
        words = splitWord.getSplitWords(content);
        for(String word : words){
            dicContent += word + " ";
        }
        date = new java.sql.Date(new java.util.Date().getTime());
    }
    public String getDicContent() {
        return dicContent;
    }

    public List<String> getWords() {
        return words;
    }



	public int getEmotionIndex() {
		return emotionIndex;
	}

	public void setEmotionIndex(int emotionIndex) {
		this.emotionIndex = emotionIndex;
	}

	public List<Float> getVec() {
		return vec;
	}

	public void setVec(List<Float> vec) {
		this.vec = vec;
	}

}
